package com.flymobi.mshop.adapter;

import android.content.Context;
import android.graphics.drawable.BitmapDrawable;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import com.flymobi.mshop.util.service.IService;
import com.flymobi.mshop.util.service.ImageService;

/**
 * 
 * @author 余鹏 图片列表的适配器
 */

public class ImageAdapter extends BaseAdapter {

	private Context mContext;
	private String[] imagePathList;

	public ImageAdapter(Context c, String[] imagePathList) {
		mContext = c;
		this.imagePathList = imagePathList;
	}

	@Override
	public int getCount() {
		return imagePathList.length;
	}

	@Override
	public Object getItem(int position) {
		return position;
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		BitmapDrawable bm = new BitmapDrawable(ImageService
				.getHttpBitmap(IService.serverUrl + imagePathList[position]));
	/*	ImageView i = new ImageView(mContext);
		i.setBackgroundResource(R.drawable.image_selector);
		i.setAdjustViewBounds(true);
		i.setImageDrawable(bm);
		i.setLayoutParams(new LayoutParams(
				android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
				android.view.ViewGroup.LayoutParams.WRAP_CONTENT));*/
		return null;
	}
}
